home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWTQueue.z / RWTQueue
Encoding:
Text File  |  1998-10-30  |  4.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTQQQQuuuueeeeuuuueeee((((3333CCCC++++++++))))                                                  RRRRWWWWTTTTQQQQuuuueeeeuuuueeee((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTQueue<T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include <rw/tqueue.h>
  13.  
  14.  
  15.  
  16.               RWTQueue<T, C> queue;
  17.  
  18.  
  19.  
  20.  
  21. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  22.      This class represents a parameterized queue.  Not only can the type of
  23.      object inserted into the queue be parameterized, but also the
  24.      implementation. Parameter TTTT represents the type of object in the queue,
  25.      either a class or built in type.  The class TTTT must have:
  26.           well-defined copy semantics (TTTT::::::::TTTT((((ccccoooonnnnsssstttt TTTT&&&&)))) or equiv.);
  27.  
  28.           well-defined assignment semantics (TTTT::::::::ooooppppeeeerrrraaaattttoooorrrr====((((ccccoooonnnnsssstttt TTTT&&&&)))) or
  29.           equiv.);
  30.  
  31.           any other semantics required by class C.
  32.  
  33.      Parameter CCCC represents the class used for implementation.  Useful choices
  34.      are RRRRWWWWTTTTVVVVaaaallllSSSSlllliiiisssstttt<<<<TTTT>>>> or RRRRWWWWTTTTVVVVaaaallllDDDDlllliiiisssstttt<<<<TTTT>>>>. Vectors, such as
  35.      RRRRWWWWTTTTVVVVaaaallllOOOOrrrrddddeeeerrrreeeeddddVVVVeeeeccccttttoooorrrr<<<<TTTT>>>>, can also be used, but tend to be less efficient
  36.      at removing an object from the front of the list.
  37.  
  38. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  39.      None
  40.  
  41. EEEExxxxaaaammmmpppplllleeee
  42.      In this example a queue of RRRRWWWWCCCCSSSSttttrrrriiiinnnnggggs, implemented as a singly-linked
  43.      list, is exercised.
  44.  
  45.               #include <rw/tqueue.h>
  46.           #include <rw/cstring.h>
  47.           #include <rw/tvslist.h>
  48.           #include <rw/rstream.h>
  49.           main() {
  50.             RWTQueue<RWCString, RWTValSlist<RWCString> > queue;
  51.             queue.insert("one");   // Type conversion occurs
  52.             queue.insert("two");
  53.             queue.insert("three");
  54.             while (!queue.isEmpty())
  55.               cout << queue.get() << endl;
  56.             return 0;
  57.           }
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTQQQQuuuueeeeuuuueeee((((3333CCCC++++++++))))                                                  RRRRWWWWTTTTQQQQuuuueeeeuuuueeee((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.      PPPPrrrrooooggggrrrraaaammmm oooouuuuttttppppuuuutttt
  75.  
  76.               one
  77.           two
  78.  
  79. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  80.      three
  81.  
  82.  
  83.  
  84.               void
  85.           cccclllleeeeaaaarrrr();
  86.  
  87.  
  88.      Removes all items from the queue.
  89.  
  90.               size_t
  91.           eeeennnnttttrrrriiiieeeessss() const;
  92.  
  93.  
  94.      Returns the number of items in the queue.
  95.  
  96.               T
  97.           ffffiiiirrrrsssstttt() const;
  98.  
  99.  
  100.      Returns, but does not remove, the first item in the queue (the item least
  101.      recently inserted into the queue).
  102.  
  103.               T
  104.           ggggeeeetttt();
  105.  
  106.  
  107.      Returns and removes the first item in the queue (the item least recently
  108.      inserted into the queue).
  109.  
  110.               RWBoolean
  111.           iiiissssEEEEmmmmppppttttyyyy() const;
  112.  
  113.  
  114.      Returns TTTTRRRRUUUUEEEE if there are no items in the queue, otherwise FFFFAAAALLLLSSSSEEEE.
  115.  
  116.               void
  117.           iiiinnnnsssseeeerrrrtttt(T a);
  118.  
  119.  
  120.      Inserts the item aaaa at the end of the queue.
  121.  
  122.               T
  123.           llllaaaasssstttt() const;
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTQQQQuuuueeeeuuuueeee((((3333CCCC++++++++))))                                                  RRRRWWWWTTTTQQQQuuuueeeeuuuueeee((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.      Returns, but does not remove, the last item in the queue (the item most
  141.      recently inserted into the queue).
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.